package ListArray;
import java.util.Arrays;


public class MyArrayList implements List{
    public int[] array;
    public int useSize;
    public MyArrayList(){
        this.array=new int[10];
    }


    @Override
    public void add(int data) {
        if (isFull()){
            grow();
        }
        array[useSize]=data;
        useSize++;
    }
    public void grow(){
        array= Arrays.copyOf(array,2*array.length);
    }

    @Override
    public boolean isFull() {
        return useSize== array.length;
    }

    @Override
    public void add(int pos, int data) {

    }

    @Override
    public boolean contains(int toFind) {
        return false;
    }

    @Override
    public int indexOf(int toFind) {
        return 0;
    }

    @Override
    public int get(int pos) {
        if (pos < 0 || pos >= useSize) {
            throw new IndexOutOfBoundsException("Index out of range: " + pos);
        }
        return array[pos];
    }

    @Override
    public void set(int pos, int value) {

    }

    @Override
    public void remove(int toRemove) {

    }

    @Override
    public int size() {
        return 0;
    }

    @Override
    public void clear() {

    }

    @Override
    public void display() {

    }



    @Override
    public boolean isEmpty() {
        return false;
    }
}
